package com.jbl.ma.controller;


import com.jbl.commonutils.R;
import com.jbl.ma.service.UserRejectService;
import com.jbl.ma.vo.UserRejectVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author jbl
 * @since 2020-12-11
 */

@CrossOrigin
@RestController
@RequestMapping("/ma/user-reject")
public class UserRejectController {
    @Autowired
    private UserRejectService userRejectService;

    @PostMapping("/reject")
    @ApiOperation("驳回申请")
    public R reject(@RequestBody UserRejectVo vo) {
        boolean reject = userRejectService.reject(vo);
        if (reject) {
            return R.ok();
        } else {
            return R.error();
        }
    }

    @PostMapping("/rejectbatch")
    @ApiOperation("批量驳回申请")
    public R rejectBatch(@RequestBody List<String> applyIds) {
        boolean reject = userRejectService.rejectBatch(applyIds);
        if (reject) {
            return R.ok();
        } else {
            return R.error();
        }
    }
}
